<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 * @author   howe <howe1995@163.com>
 */

namespace App\Model;

use function Hyperf\Support\env;

class File extends Model
{
    protected array $fillable = [
        'name',
        'path',
        'thumbnail_path',
        'size',
        'width',
        'height',
        'duration',
        'signature',
        'type',
        'format',
    ];

    public function getPathAttribute($value): string
    {
        if (empty($value)) {
            return '';
        }
        return env('STATIC_FILE_URL') . $value;
    }

    public function getThumbnailPathAttribute($value): string
    {
        if (empty($value)) {
            return '';
        }
        return env('STATIC_FILE_URL') . $value;
    }
}
